/**
 * 获取登录token
 * @param  {Object} state Vuex状态对象
 * @return {String}       token
 */
import Vue from "vue";

import { ACCESS_TOKEN, USERINFO } from "./mutation-types";
export const token = state => state.user.token || Vue.ls.get(ACCESS_TOKEN);
export const getUserInfo = state => {
  if (state.user.userInfo && Object.keys(state.user.userInfo).length) {
    return state.user.userInfo;
  } else {
    return Vue.ls.get(USERINFO);
  }
};
